﻿using System;
using System.Collections.Generic;

namespace KMF.Utility
{
    public class ArrayUntil
    {
        public static void Shuffle<T>(List<T> list)
        {
            var length = list.Count;
            for(int i= 0; i< length;i++)
            {
                var rand = new Random();
                var r = rand.Next(length - i);
                r = rand.Next(length - i);
                var j = i + r;
                Swap(list,i,j);
            }
        }

        public static void Swap<T>(List<T> list,int i,int j)
        {
            T current = list[i];
            list[i] = list[j];
            list[j] = current;
        }
    }
}
